# !/usr/bin/env python
# coding:utf-8
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import os

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(os.path.dirname(BASE_DIR))
PROJECT_NAME = os.path.basename(BASE_DIR)


settings_dir = os.path.join(BASE_DIR, PROJECT_NAME, 'settings')
setting_file = os.path.join(settings_dir, 'dev.py')
if not os.path.exists(setting_file):
    setting_file = os.path.join(settings_dir, 'production.py')
if not os.path.exists(setting_file):
    raise Exception(
        'There is no dev.py or production.py file in settings directory'
    )

setting_file_name = os.path.basename(setting_file).split('.')[0]

SETTING_NAME = '%s.settings.%s' % (PROJECT_NAME, setting_file_name)
